home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Misc. Utilities / Installer / Installer 3.3 / Samples - Installer 3.3 / InstallFont.r
Encoding:
Text File  |  1992-01-22  |  6.8 KB  |  177 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.3 sample: installing a font resource into the appropriate place
  6.  *
  7.  *    File:        InstallFont.r -    Rez Source
  8.  *
  9.  *    by:            Rich Kubota
  10.  *
  11.  *    Copyright © 1991 Apple Computer, Inc.
  12.  *    All rights reserved.
  13.  *
  14.  *------------------------------------------------------------------------------
  15.  * This sample installs the "Times" font resource, supplied with System 7.0.1, into
  16.  * the appropriate place: the system file, using the new 'inff' Font Family
  17.  * Resource Atom.
  18.  * It allows for custom installation/removal.
  19.  *----------------------------------------------------------------------------*/
  20.  
  21. #include "Types.r"                    /* for the ICON resource */
  22. #include "InstallerTypes.r"
  23.  
  24. /* You can build and complete the script with the following lines:
  25. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  26. # or set up folders with the same names and contents as the floppies
  27. # put these folders in the same folder as the script or at the root directory of same disk
  28.  
  29.     rez -o "Install Font Script" -t 'bbkr' -c 'bbkr' "InstallFont.r"
  30.     setfile -a i "Install Font Script"        #mark Inited
  31.     scriptcheck -p "Install Font Script"
  32. */
  33.  
  34. /*
  35.  * To create the installation disk
  36.  * 1. Name the floppy disk "Install Font Script".
  37.  * 2. Copy Installer 3.3 onto the floppy.
  38.  * 3. Copy the Times font suitcase from the 7.0.1 Font Installation Disk to the floppy.
  39.  * 4. Rez and ScriptCheck this script, and copy to the floppy.
  40.  * 5. You're all set.
  41.  */
  42.  
  43. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  44. #define kScriptCheckSetsDate    1
  45. #define kTimesFontSize            287250  /* file is 287228 bytes + buffer */
  46.  
  47. /* Definitions for the rules */
  48. #define fontRule            1000
  49.  
  50. /* Defines for the file spec atoms.  These are specifications for source and destination files */
  51. #define fsSourceFont        2000
  52. #define fsTargetSystem        2001
  53.  
  54. /* This is the name of the source disk */
  55. #define FontDisk "Font Installer:"
  56.  
  57. /* where we want to install our Font. */
  58. #define TargetPath "special-macs:"
  59.  
  60. /* Definition for the packages. */
  61. #define pkTheFont            3000
  62.  
  63. /* Definition for the font resource atom. */
  64. #define ffTheFont            4000
  65.  
  66. /* Definition for the package comment resource */
  67. #define cmtTheFont            5000
  68. #define iconTheFont            6000
  69.  
  70. /* December 10, 1991 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  71. /* this value to a LongInt seconds value needed by the Installer. */
  72. #define currentReleaseDate    12101991        
  73. #define currentVersion        100     /* Version 1.0 goes in the 'icmt' rsrc */
  74.  
  75.  
  76. /************************** Easy Install Rule resources **********************************/
  77. resource 'infr' (1) {
  78.     format0  {{
  79.         pickAll,    {fontRule},     /* Select the Font rule */
  80.     }};
  81. };
  82.  
  83. resource 'inrl' (fontRule) {
  84.     format0 {{
  85.         addUserDescription {"Click Install button to install\n"},    
  86.                                             /* message to appear in Easy Install screen */
  87.         addUserDescription {"Times Font\n"}, /* 2nd line of message */
  88.         addPackages {{pkTheFont}}            /* installing the font package */
  89.     }};
  90. };
  91.  
  92. /***************************** Package Resources ************************************************/
  93. resource 'inpk' (pkTheFont) {        /* This package could include other atoms */
  94.     format0 {
  95.         showsOnCustom,                 /* Package appears in the Custom Install display */
  96.         removable,                    /* Package can be removed */
  97.         forceRestart,                /* not necessary to reboot in this case */
  98.         cmtTheFont,                 /* package's 'icmt' resource id */
  99.         0,                            /* Package size to be entered manually */
  100.                                     /* ScriptCheck wont do this for us since it doesn't recognize */
  101.                                     /* the 'inff' atom.  ScriptCheck will determine the sum of    */
  102.                                     /* sizes of the recognized atoms and insert the sum into      */
  103.                                     /* this field.  Use ResEdit later to modify this field to     */
  104.                                     /* include the font resource size.  Note that the size is for */
  105.                                     /* informational use only at the Custom window    */
  106.         "package which includes Times Font", { /* package name for package that shows on custom */
  107.             'inff', ffTheFont;
  108.         }
  109.     }
  110. };
  111.  
  112. /***************************** Comments ************************************************/
  113. resource 'icmt' (cmtTheFont) {
  114.     currentReleaseDate,
  115.     currentVersion,
  116.     iconTheFont,
  117.     "This package includes the Times Font. "
  118. };
  119.  
  120. resource 'ICON' (iconTheFont) {
  121.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  122.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  123.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  124.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  125.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  126.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  127.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  128.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  129. };
  130.  
  131.  
  132.  
  133. /********************************************* File Specs *******************************************/
  134. /* Source File Specs */
  135. resource 'infs' (fsSourceFont) {
  136.     'FFIL',                                /* File Type */
  137.     'DMOV',                                /* Creator */
  138.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  139.     noSearchForFile,                    /* Do not search the source disk for the file */
  140.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  141.     FontDisk"Times"                /* Path to the file */
  142. };
  143.  
  144. resource 'infs' (fsTargetSystem) {
  145.     'ZSYS',                                /* File Type */
  146.     'MACS',                                /* Creator */
  147.     0,                                    /* creation date not needed for target file specs */
  148.     noSearchForFile,                    /* Do not search the target disk for the file */
  149.     typeCrNeedNotMatch,                    /* match system 6 or 7 */
  150.     TargetPath"System"                    /* destination Path */
  151. };
  152.  
  153. /*************************************** Font Family Atoms **********************************************/
  154. resource 'inff' (ffTheFont) {
  155.     format0 {
  156.         deleteWhenRemoving,                /* Delete the resource if remove (option-custom) is clicked    */
  157.         dontDeleteWhenInstalling,         /* dont need to delete the target before copying new one */
  158.         copy,                             /* Copy rsrc to destination */
  159.         tgtRequired,                     /* Target file need already exist on dest to install */
  160.         updateExisting,                 /* replace any preexisting DA with the same name */
  161.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  162.         ignoreProtection,                /* Do it even if the target rsrc is protected */
  163.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  164.         byName,                            /* use the name to find the source and target rsrc */
  165.         nameMustMatch,                    /* this field is ignored if above is byName */
  166.         fsTargetSystem,                    /* Target file spec to install rsrc into */
  167.         fsSourceFont,                    /* Source file spec where to get rsrc */
  168.         0x20,                            /* 'FOND' is purgeable */
  169.         kTimesFontSize,                    /* font resource size entered manually */
  170.         20,                                /* Resource ID of Times 'FOND' */
  171.         entireFamily {                    /* all strikes found in FOND to be installed */
  172.         },
  173.         "Times Font",                    /* Atom description */
  174.         "Times"                            /* Font Resource name */
  175.     };
  176. };
  177.